// 基于template/src/widgets/{{appEntities}}/{{ctrls@TREEVIEW}}-tree/{{spinalCase ctrl.codeName}}-tree-model.ts.hbs生成
import { ITreeModel, ITreeNodeModel, ITreeNodeRsModel } from '@/core';

function getModel(): ITreeModel {
	return {
		name: 'treeexpbar_tree',
		caption: '',
		codeName: 'Usr0301036524',
		cssName: '',
		controlType: 'TREEVIEW',
		entityCodeName: 'Sys_organization',
		rootVisible: false,
		treeNodes: getTreeNodes(),
		treeNodeRSs: getTreeNodeRSs(),
	};
}

function getTreeNodes(): ITreeNodeModel[] {
	return [
		{
			id: 'ROOT',
			treeNodeType: 'STATIC',
			allowDrag: false,
			allowDrop: false,
			allowEditText: false,
			allowOrder: false,
			enableCheck: false,
			disableSelect: false,
			expanded: false,
			cssName: '',
			leaf: false,
			selected: false,
			navFilter: '',
			appendPNodeId: false,
			counterId: '',
			counterMode: 0,
			nodeType: 'ROOT',
			rootNode: true,
			selectFirstOnly: false,
			expandFirstOnly: false,
			enableQuickSearch: false,
			text: '默认根节点',
			tooltip: '',
			nodeValue: 'root',
			navigateContext: {},
			navigateParams: {},
		},
		{
			id: 'AllOrganizations',
			treeNodeType: 'STATIC',
			allowDrag: false,
			allowDrop: false,
			allowEditText: false,
			allowOrder: false,
			enableCheck: false,
			disableSelect: false,
			expanded: false,
			cssName: '',
			leaf: true,
			selected: false,
			navFilter: '',
			appendPNodeId: false,
			counterId: '',
			counterMode: 0,
			nodeType: 'AllOrganizations',
			rootNode: false,
			selectFirstOnly: false,
			expandFirstOnly: false,
			enableQuickSearch: false,
			text: '全部机构',
			tooltip: '',
			nodeValue: '',
			navViewName: 'sys_organizationManagementView',
			navigateContext: {},
			navigateParams: {},
		},
		{
			id: 'Subordinates',
			treeNodeType: 'DE',
			allowDrag: false,
			allowDrop: false,
			allowEditText: false,
			allowOrder: false,
			enableCheck: false,
			disableSelect: false,
			expanded: false,
			cssName: '',
			leaf: false,
			selected: false,
			navFilter: '',
			appendPNodeId: false,
			counterId: '',
			counterMode: 0,
			nodeType: 'Subordinates',
			rootNode: false,
			selectFirstOnly: false,
			expandFirstOnly: false,
			enableQuickSearch: false,
			cssClass: 'fa fa-university',
			entityCodeName: 'Sys_organization',
			controlVoName: 'SubordinatesControlVO',
			keyPSAppDEField: 'Id',
			majorPSAppDEField: 'Organization_name',
			appDeDataSet: 'FetchDefault',
			sortDir: 'ASC',
			sortPSAppDEField: 'Sort',
			navViewName: 'sys_organizationNewEditView',
			navigateContext: {},
			navigateParams: {},
			contextMenus: [
				{
					name: 'deuiaction1',
					ctrlname: 'subordinates_cm',
					nodeOwner: 'Subordinates',
					caption: '刷新',
					showCaption: true,
					showIcon: true,
					tooltip: '刷新',
					uiAction: {
						actionTag: 'RefreshParent',
						actionTarget: '',
						dataAccessAction: '',
						noPrivDisplayMode: 2,
						visible: true,
						disabled: false,
						uIActionMode: 'SYS',
						uIActionType: 'DEUIACTION',
						actionDECodeName: 'Sys_organization',
						predefinedType: 'TREEVIEW_REFRESHPARENTACTION',
					},
					cssClass: 'fa fa-refresh',
				},
			],
		},
		{
			id: 'TopOrganizations',
			treeNodeType: 'DE',
			allowDrag: false,
			allowDrop: false,
			allowEditText: false,
			allowOrder: false,
			enableCheck: false,
			disableSelect: false,
			expanded: true,
			cssName: '',
			leaf: false,
			selected: false,
			navFilter: '',
			appendPNodeId: false,
			counterId: '',
			counterMode: 0,
			nodeType: 'TopOrganizations',
			rootNode: false,
			selectFirstOnly: false,
			expandFirstOnly: true,
			enableQuickSearch: false,
			cssClass: 'fa fa-university',
			entityCodeName: 'Sys_organization',
			controlVoName: 'TopOrganizationsControlVO',
			keyPSAppDEField: 'Id',
			majorPSAppDEField: 'Organization_name',
			appDeDataSet: 'FetchMaintenance',
			sortDir: 'ASC',
			sortPSAppDEField: 'Sort',
			navViewName: 'sys_organizationNewEditView',
			navigateContext: {},
			navigateParams: {},
			contextMenus: [
				{
					name: 'deuiaction1',
					ctrlname: 'toporganizations_cm',
					nodeOwner: 'TopOrganizations',
					caption: '刷新',
					showCaption: true,
					showIcon: true,
					tooltip: '刷新',
					uiAction: {
						actionTag: 'RefreshParent',
						actionTarget: '',
						dataAccessAction: '',
						noPrivDisplayMode: 2,
						visible: true,
						disabled: false,
						uIActionMode: 'SYS',
						uIActionType: 'DEUIACTION',
						actionDECodeName: 'Sys_organization',
						predefinedType: 'TREEVIEW_REFRESHPARENTACTION',
					},
					cssClass: 'fa fa-refresh',
				},
			],
		},
	];
}

function getTreeNodeRSs(): ITreeNodeRsModel[] {
	return [
		{
			childDeTreeNodeId: 'TopOrganizations',
			parentPSDETreeNodeId: 'ROOT',
			parentValueLevel: 1,
			searchMode: 3,
			navigateContext: {},
			navigateParams: {},
		},
		{
			childDeTreeNodeId: 'Subordinates',
			parentFilter: 'PARENT_ID',
			parentPSDETreeNodeId: 'TopOrganizations',
			parentValueLevel: 1,
			searchMode: 3,
			navigateContext: {},
			navigateParams: {},
		},
		{
			childDeTreeNodeId: 'Subordinates',
			parentFilter: 'PARENT_ID',
			parentPSDETreeNodeId: 'Subordinates',
			parentValueLevel: 1,
			searchMode: 3,
			navigateContext: {},
			navigateParams: {},
		},
		{
			childDeTreeNodeId: 'AllOrganizations',
			parentPSDETreeNodeId: 'ROOT',
			parentValueLevel: 1,
			searchMode: 3,
			navigateContext: {},
			navigateParams: {},
		},
	];
}
export const model = getModel();
